<template>
    <h1>理财信息展示页面</h1>

    项目名称:
    <input type="text" v-model="Name" >

    <input type="button" value="查询" @click="ShowBorrow" >

    <table>
        <thead>
            <tr>
                <th>理财编号</th>
                <th>项目名称</th>
                <th>年收益</th>
                <th>最低金额</th>
                <th>理财人数</th>
                <th>风险等级</th>
                <th>操作</th>
            </tr>
        </thead>

        <tbody>
            <tr v-for="item in Show" >
                <td> {{ item.B_Id }} </td>
                <td> {{ item.B_Name }}</td>
                <td> {{ item.B_YearMoney }}</td>
                <td> {{ item. B_MinMoney}}</td>
                <td> {{ item.B_Count }}</td>
                <td> {{ item.B_Fxbj }}</td>
                <td>
                    <input type="button" value="修改" >
                </td>
            </tr>
        </tbody>
    </table>

</template>

<script setup lang="ts">

import {ref,onMounted} from 'vue'
import axios from 'axios'

const Show = ref([{
    B_Id:'',
    B_Name:'',
    B_YearMoney:'',
    B_MinMoney:'',
    B_Count:'',
    B_Fxbj:''
}])

const Name =ref('')

onMounted (()=>{
    ShowBorrow();
})

const ShowBorrow = ()=>{
    axios({
        url:'http://localhost:52659/api/Borrow/ShowBorrow',
        method:'get',
        params:{
            Name:Name.value
        }
    })
    .then((res)=>{
        console.log(res.data);
        Show.value = res.data;
    })
    .catch((err)=>{
        console.log(err);
    })
}

</script>